package org.example.encoding;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @Author :tuhan
 * @Date : 2021/3/23 17:38
 **/
public class Dynamic implements InvocationHandler {

    //需要代理的类
    private Object target;

    public Dynamic(Object target){
        this.target=target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("invoke 前");

        method.invoke(target,args);

        System.out.println("invoke 后");

        return "123";
    }

}
